Chart B
instacart |>
group_by(department) |>
summarize(orders = n_distinct(order_id)) |>
plot_ly(
x = ~orders, y = ~ fct_reorder(department, orders),
type = "bar"
)
Chart C
instacart |>
mutate(
department = fct_reorder(department, days_since_prior_order)) |>
plot_ly(x = ~ department, y = ~ days_since_prior_order, color = ~ department,
type = "box")
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors